TRIGGER PROCEDURE FOR DELETE OF MND_DET.

{mfdeclre.i }
define new shared work-table wf_old_mnd_det like mnd_det.

HK:
do:
    if can-find(first dt_mstr where dt_table = "mnd_det" and dt_type = "SYNC") then
        run CreateSyncFlag(input "DEL", input recid(mnd_det), input "mnd_det").

    if not can-find ( first dt_mstr where dt_table = "mnd_det" and dt_type = "DEL" ) then leave HK.
    
    if not can-find ( first wf_old_mnd_det ) then do:
        create wf_old_mnd_det.
        if recid(wf_old_mnd_det)= -1 then .
    end.
    
    buffer-copy mnd_det to wf_old_mnd_det no-error.

    for first dt_mstr no-lock where dt_table = "mnd_det" and dt_type = "DEL" :
    
    	run CreateDthist(input dt_table, input dt_field, input dt_type, input "", input "", 
        	input recid(mnd_det), input mnd_det.mnd_nbr, input string(mnd_det.mnd_select), input "", input "",
        	input "", input "", input "", input "") .
        	
    end.
end.

{hkdttrans.i}
